document.addEventListener('click', function(e) {
		e = e || window.event;
		var el = e.target || e.srcElement;

		if (el.nodeName == 'DIV') {
			var p = el.parentNode;
			if  (p.nodeName == 'SECTION') {
				if (p.getElementsByTagName('INPUT').length == 0) {
					addNoteDiv(p);
				}
			}
		}
	}, false);

document.addEventListener('blur', function(e) {
		e = e || window.event;
		var el = e.target || e.srcElement;
	
		if (el.nodeName == 'INPUT') {
		var txt = el.innerHTML;
	
			var notes = {};
			notes[e.id] = txt;
			localStorage.setItem('notes', notes);
		}
	}, false);


function addNoteDiv(el) {
	var myNote = document.createElement('input');
	var noteID = 'note' + el.id;

	myNote.setAttribute('id', noteID);
	myNote.setAttribute('type', 'text');
	myNote.setAttribute('placeholder', 'Your note here ...');
	el.appendChild(myNote);
	
}

